package com.pingba.entity.friend;

import com.pingba.entity.BaseEntity;
import com.pingba.entity.User;

import java.util.Date;

/**
 * Created by Administrator on 2015/11/9 0009.
 */
public class FriendApply extends BaseEntity {
    public static final int StatusDefault = 0;
    public static final int StatusDeny = -1;
    public static final int StatusAgree = 1;


    private long sid;           //流水号
    private long fromUserId;    //发起者用户id
    private long toUserId;      //目标者用户id
    private int status;         //消息的处理状态码，初始为0，拒绝为-1，同意为1
    private boolean handled;    //消息是否处理过，默认为false，
    private long applyTime;     //消息的申请时间
    private String content;     // 申请内容
    private String fromUserName;   // 申请名字
    private String fromUserHeadUrl;   // 申请的头像


    public static FriendApply getTemplate(long fromUserId, long toUserId) {
        FriendApply apply = new FriendApply();
        apply.setApplyTime(new Date().getTime());
        apply.setFromUserId(fromUserId);
        apply.setToUserId(toUserId);
        apply.setHandled(false);
        apply.setStatus(StatusDefault);
        return apply;
    }

    public static FriendApply getTemplate(User fromUser, long toUserId, String content) {
        FriendApply apply = new FriendApply();
        apply.setApplyTime(new Date().getTime());
        apply.setFromUserId(fromUser.getSid());
        apply.setFromUserName(fromUser.getNickName());
        apply.setFromUserHeadUrl(fromUser.getHeadUrl());
        apply.setToUserId(toUserId);
        apply.setHandled(false);
        apply.setContent(content);
        apply.setStatus(StatusDefault);
        return apply;
    }


    public long getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(long applyTime) {
        this.applyTime = applyTime;
    }

    public long getFromUserId() {
        return fromUserId;
    }

    public void setFromUserId(long fromUserId) {
        this.fromUserId = fromUserId;
    }

    public boolean isHandled() {
        return handled;
    }

    public void setHandled(boolean handled) {
        this.handled = handled;
    }

    public long getSid() {
        return sid;
    }

    public void setSid(long sid) {
        this.sid = sid;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public static int getStatusAgree() {
        return StatusAgree;
    }

    public static int getStatusDeny() {
        return StatusDeny;
    }

    public long getToUserId() {
        return toUserId;
    }

    public void setToUserId(long toUserId) {
        this.toUserId = toUserId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getFromUserHeadUrl() {
        return fromUserHeadUrl;
    }

    public void setFromUserHeadUrl(String userHeaderUrl) {
        this.fromUserHeadUrl = userHeaderUrl;
    }

    public String getFromUserName() {
        return fromUserName;
    }

    public void setFromUserName(String fromUserName) {
        this.fromUserName = fromUserName;
    }
}
